@echo off
setlocal enabledelayedexpansion

echo ==========================================
echo Linux Build Test Script
echo ==========================================

echo.
echo This script will test Linux build environment
echo.

REM Check Docker
echo Checking Docker...
docker --version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Docker not installed or not running
    pause
    exit /b 1
)

echo Docker check passed!
echo.

REM Test simple Docker build
echo Testing Docker build environment...
echo.

REM Create test Dockerfile
echo Creating test Dockerfile...

(
echo FROM ubuntu:22.04
echo RUN apt update ^&^& apt install -y cmake g++ make git
echo WORKDIR /test
echo RUN echo "Testing build environment..." ^> test.txt
echo RUN echo "Build tools installed successfully!" ^>^> test.txt
echo RUN cat test.txt
) > test.Dockerfile

echo Test Dockerfile created
echo.

REM Build test image
echo Building test image...
docker build -f test.Dockerfile -t sokit-test .

if %errorlevel% equ 0 (
    echo.
    echo ==========================================
    echo Docker build environment test successful!
    echo ==========================================
    echo.
    echo Now you can run full Linux build:
    echo   quick_linux_build.bat
    echo.
    echo Or run manually:
    echo   docker_build.sh
    echo.
) else (
    echo.
    echo Docker build environment test failed!
    echo Please check if Docker service is running properly
)

REM Clean up test files
del test.Dockerfile

echo.
echo Test completed!
pause 